<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main">
    <section class="sec_1">
        <div class="div_1">
            <ul>
                <li><a href="/certificate/my">个人信息</a></li>
                <!-- <li><a href="/certificate/findApplyExam">报名记录</a></li> -->
                <li><a href="/certificate/infoRecordList">表单提交记录</a></li>
                <li class="this"><a href="/certificate/expertRecordList">专家申请记录</a></li>
                <li><a href="/certificate/stationRecordList">考核站点申请记录</a></li>
                <li><a href="/certificate/stationPxRecordList">培训基地申请记录</a></li>
                <li><a href="/certificate/gradeQuery">成绩查询</a></li>
                <li><a href="/certificate/message">消息中心</a></li>
                <li><a href="/certificate/mock?grade=2" target="_blank">幼儿照护初级模拟考试</a></li>
                <li><a href="/certificate/mock?grade=1" target="_blank">幼儿照护中级模拟考试</a></li>
                <li><a href="/certificate/mock?grade=0" target="_blank">幼儿照护高级模拟考试</a></li>
            </ul>
        </div>
        <div class="div_2">
            <label class="label_title">专家申请记录</label>
            <hr/>
            <div id="news"></div>
            <div id="page"></div>
        </div>
        <div style="clear: both"></div>
    </section>
</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
</body>
<script>
    $(function () {
        ajaxToken("/jzApi/user/selMyExpertsList", "GET", {
            current: 1,
            number:8,
            t: new Date()//解决在IE11浏览器下,JQuery的AJAX方法第二次不响应问题,保证每次请求的参数都不相同
        }, function (res) {
            if (res.pages == 0) {
                $("#news").html('<div class="noData">暂无数据</div>');
            } else {
                var list = res.records;
                var news = '';
                list.forEach(function (item, index) {
                    var a = '';
                    var b = '';
                    var c = '';
                    if (item.type == 0) {
                        b = '考评员'
                    }
                    if (item.type == 1) {
                        b = '考务员'
                    }
                    if (item.type == 2) {
                        b = '考务技术员'
                    }
                    if (item.type == 3) {
                        b = '督导员'
                    }
                    if (item.type == 4) {
                        b = '讲师'
                    }
                    if (item.state == 0) {
                        a = '<span style="color: blue" id="state">待审核</span>';
                    }
                    if (item.state == 1) {
                        a = '<span style="color: green" id="state">已通过</span>';
                    }
                    if (item.state == 2) {
                        var remark = '';
                        if (item.remark == null) {
                            remark = '';
                        } else {
                            remark = item.remark;
                        }
                        a = '<span style="color: red" id="state">未通过</span>';
                        c = '<div style="display: flex;justify-content: space-between;align-items: center;">' +
                            '<div class="span_1" style="flex: 6"><span class="title_1">备注：</span><p style="color: red" class="title_2">' + remark + '</p></div>' +
                            '<div class="span_1" style="flex: 2;text-align: right"><a href="#" class="my_btn" style="flex:1;text-align: center" onclick="edit(\'' + item.id + '\')" >修改</a></div>' +
                            '</div>'
                    }
                    if (item.state == 3) {
                        a = '<span>审核状态：<span style="color: grey" id="state">已停用</span></span>';
                    }
                    if (item.state == 4) {
                        a = '<span style="color: green" id="state">已考核</span>';
                    }
                    if (item.state == 5) {
                        a = '<span style="color: green" id="state">已培训</span>';
                    }
                    if (item.state == 6) {
                        a = '<span style="color: green" id="state">草稿</span>';
                    }
                    if (item.state == 9) {
                        a = '<span style="color: gray" id="state">已删除</span>';
                    }
                    news += '<div class="my_bg div_01">' +
                        '<div style="display: flex">' +
                        '<div class="span_1"><span class="title_1">专家类型：</span><p class="title_2">' + b + '</p></div>' +
                        '<div><span class="title_1">审核状态：</span><p class="title_2">' + a + '</p></div>' +
                        '</div>' +
                        '<div>' +
                        '<div class="span_1"><span class="title_1">负责证书：</span><p class="title_2">' + item.profileName + '</p></div>' +
                        '</div>' +
                        '<div>' +
                        '<div class="span_1"><span class="title_1">申请时间：</span><p class="title_2">' + item.applicantDate + '</p></div>' +
                        '</div>' +
                        c +
                        '</div>';
                });
                $("#news").html(news);
                page(1, res.pages);
            }
        })
    });

    function page(num, tolPages) {
        $("#page").paging({
            nowPage: Number(num), // 当前页码
            pageNum: Number(tolPages), // 总页码
            buttonNum: 3, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数
                ajaxToken("/jzApi/user/selMyExpertsList", "GET", {
            current: num,
            number: 8,
            t: new Date()//解决在IE11浏览器下,JQuery的AJAX方法第二次不响应问题,保证每次请求的参数都不相同
        }, function (res) {
            if (res.pages == 0) {
                $("#news").html('<div class="noData">暂无数据</div>');
            } else {
                var list = res.records;
                var news = '';
                list.forEach(function (item, index) {
                    var a = '';
                    var b = '';
                    var c = '';
                    if (item.type == 0) {
                        b = '考评员'
                    }
                    if (item.type == 1) {
                        b = '考务员'
                    }
                    if (item.type == 2) {
                        b = '考务技术员'
                    }
                    if (item.type == 3) {
                        b = '督导员'
                    }
                    if (item.type == 4) {
                        b = '讲师'
                    }
                    if (item.state == 0) {
                        a = '<span style="color: blue" id="state">待审核</span>';
                    }
                    if (item.state == 1) {
                        a = '<span style="color: green" id="state">已通过</span>';
                    }
                    if (item.state == 2) {
                        var remark = '';
                        if (item.remark == null) {
                            remark = '';
                        } else {
                            remark = item.remark;
                        }
                        a = '<span style="color: red" id="state">未通过</span>';
                        c = '<div style="display: flex;justify-content: space-between;align-items: center;">' +
                            '<div class="span_1" style="flex: 6"><span class="title_1">备注：</span><p style="color: red" class="title_2">' + remark + '</p></div>' +
                            '<div class="span_1" style="flex: 2;text-align: right"><a href="#" class="my_btn" style="flex:1;text-align: center" onclick="edit(\'' + item.id + '\')" >修改</a></div>' +
                            '</div>'
                    }
                    if (item.state == 3) {
                        a = '<span>审核状态：<span style="color: grey" id="state">已停用</span></span>';
                    }
                    if (item.state == 4) {
                        a = '<span style="color: green" id="state">已考核</span>';
                    }
                    if (item.state == 5) {
                        a = '<span style="color: green" id="state">已培训</span>';
                    }
                    if (item.state == 9) {
                        a = '<span style="color: gray" id="state">已删除</span>';
                    }
                    news += '<div class="my_bg div_01">' +
                        '<div style="display: flex">' +
                        '<div class="span_1"><span class="title_1">专家类型：</span><p class="title_2">' + b + '</p></div>' +
                        '<div><span class="title_1">审核状态：</span><p class="title_2">' + a + '</p></div>' +
                        '</div>' +
                        '<div>' +
                        '<div class="span_1"><span class="title_1">负责证书：</span><p class="title_2">' + item.profileName + '</p></div>' +
                        '</div>' +
                        '<div>' +
                        '<div class="span_1"><span class="title_1">申请时间：</span><p class="title_2">' + item.applicantDate + '</p></div>' +
                        '</div>' +
                        c +
                        '</div>';
                });
                $("#news").html(news);
            }
        })
            }
        });
    }

    function edit(id) {
        location.href = "/certificate/editExpert?id=" + id
    }
</script>
<script type="text/javascript" src="/js/xlPaging.js"></script>
</html>